<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<base href="<%=basePath%>">
<!-- 即时通讯 -->
	<script type="text/javascript" src="plugins/websocketInstantMsg/ext4/ext-all-debug.js"></script>
	<script type="text/javascript" src="plugins/websocketInstantMsg/websocket.js"></script>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="static/css/navigation.css" />
<title>CIOS维修支持系统</title>
</head>
<body>
	<div class="wrapper">
		<div class="title">
			<img class="title-img" src="static/images/navigation/title.png" alt="">
		</div>
		<div class="content">
			<div class="content-top">
				<div  class="integratedMonitoring" style="display: none;">
						<img id="1" src="static/images/navigation/1.png" alt="">
				</div>
				<div  class="monitoringSystem" style="display: none;">
						<img id="2"  src="static/images/navigation/2.png" alt="">
				</div>
				<div  class="ticketingManagement" style="display: none;">
						<img id="3" src="static/images/navigation/3.png" alt="">
				</div>
			</div>
			<div class="content-bottom">
				<div class="informatization" style="display: none;">
						<img id="4" src="static/images/navigation/4.png" alt="">
				</div>
				<div  class="industrySupervision" style="display: none;">
						<img id="5" src="static/images/navigation/5.png" alt="">
				</div>
				<div  class="emergencyCommand" style="display: none;">
						<img id="6" src="static/images/navigation/6.png" alt="">
				</div>
				<div  class="operate" style="display: none;">
						<img id="7" src="static/images/navigation/7.png" alt="">
				</div>
				<div  class="platform" style="display: none;">
						<img id="8" src="static/images/navigation/8.png" alt="">
				</div>
			</div>
		</div>
		<!-- <div class="footer">
			<img src="static/images/navigation/setting.png" alt="">
		</div> -->
	</div>
</body>
<script type="text/javascript">window.jQuery || document.write("<script src='static/js/jquery-1.9.1.min.js'>\x3C/script>");</script>
		<script src="static/js/bootstrap.min.js"></script>
		<script src="static/js/ace-elements.min.js"></script>
		<script src="static/js/ace.min.js"></script>
		<!-- 引入 -->
		<script type="text/javascript" src="static/js/jquery.cookie.js"></script>
<script type="text/javascript">
var rootPath = getRootPath();
var returnUrl;
var param ={};
param['USER_ID'] ="${user.USER_ID}";
var url =rootPath+'/subSysRole/list.do';
$.ajax({
    type : "post",
    async : false,
    url : url, //实际上访问时产生的地址为
    data : param,
    cache : false, //默认值true
    dataType : "jsonp",
    jsonp: "callbackfun",
    jsonpCallback:"success_getSubMenuList",
    success : function(callback){
		var list = callback.list;
		$(".sub_menu").remove();
		if(list.length > 0){
			for(var i=0;i<list.length;i++){
				if(list[i].MENU_ID!=null){
					$("#"+list[i].MENU_ID).attr("onclick","goOtherSys('"+list[i].URL+"','"+list[i].MENU_ID+"');");
					$("#"+list[i].MENU_ID).attr("style","cursor:pointer;");
					document.getElementById(list[i].MENU_ID).parentNode.style.display="";
					if(list[i].MENU_ID==8){
						returnUrl=list[i].URL;
					}
				}
			}
		}
    },
    error:function(){
       // alert("error");
    }
});


function goOtherSys(obj,menuID){
	
	if(menuID!="8"){
		//系统平台设置
		validToken();
		 if(localStorage.getItem("code")==001003){
			 window.location.href=rootPath+"/";
		 }else{
			 window.location.href=obj+"?token="+localStorage.getItem("token");
		 }
	     
	}else{
		if(menuID==8){
			validToken();
			if(localStorage.getItem("code")==001003){
				 window.location.href=rootPath+"/";
			 }else{
				 window.location.href=getRootPath()+"/main/index?token="+localStorage.getItem("token");
			 }
		}
	}
}


function validToken(){
	$.ajax({
        type : "post",
        async : false,
        url : rootPath+"//validToken", //实际上访问时产生的地址为
        data : param,
        cache : false, //默认值true
        dataType : "json",
        success : function(callback){
        	localStorage.clear();
    		var code = callback.code;
    		var msg = callback.msg;
    		var token = callback.token;
    		if(code==001003){
    			localStorage.setItem('code',code);//存入错误代码
    			localStorage.setItem('msg',msg);//存入错误信息
    		}
    		localStorage.setItem('token',token); // 存入一个值
    		
        },
        error:function(){
            //alert("error");
        }
    });
}


function getRootPath() {
	// 获取当前网址，如： http://localhost:8083/uimcardprj/share/meun.jsp
	var curWwwPath = window.document.location.href;
	// 获取主机地址之后的目录，如： uimcardprj/share/meun.jsp
	var pathName = window.document.location.pathname;
	var pos = curWwwPath.indexOf(pathName);
	// 获取主机地址，如： http://localhost:8083
	var localhostPaht = curWwwPath.substring(0, pos);
	// 获取带"/"的项目名，如：/uimcardprj
	var projectName = pathName.substring(0,
			pathName.substring(1).indexOf('/') + 1);
	return (localhostPaht + projectName);
}

</script>
</html>